<?php
require_once(realpath(dirname(__FILE__)) . '/../../Aplicación/models/interfaces/IClient.php');
require_once(realpath(dirname(__FILE__)) . '/../../Aplicación/models/InvoceProduct.php');
require_once(realpath(dirname(__FILE__)) . '/../../Aplicación/models/interfaces/IInvoce.php');

/**
 * @access public
 * @author Edgar Morán
 * @package Aplicación.models
 */
class Invoice implements IInvoce {
	/**
	 * @AttributeType int
	 */
	private $_id;
	/**
	 * @AttributeType datetime
	 */
	private $_date;
	/**
	 * @AssociationType Aplicación.models.interfaces.IClient
	 */
	public $_iClient;
	/**
	 * @AssociationType Aplicación.models.InvoceProduct
	 * @AssociationKind Composition
	 */
	public $_invoiceProducts;
    
    /**
     * constructor for class
     */
    public function __construct($date, $client){
        $this->_date = $date;
        $this->_iClient = $client;
        $this->_invoiceProducts = array();
    }

	/**
	 * @access public
	 * @return int
	 * @ReturnType int
	 */
	public function getId() {
		return $this->_id;
	}

	/**
	 * @access public
	 * @param int aId
	 * @return void
	 * @ParamType aId int
	 * @ReturnType void
	 */
	public function setId($aId) {
		$this->_id = $aId;
	}

	/**
	 * @access public
	 * @return datetime
	 * @ReturnType datetime
	 */
	public function getDate() {
		return $this->_date;
	}

	/**
	 * @access public
	 * @param datetime aDate
	 * @return void
	 * @ParamType aDate datetime
	 * @ReturnType void
	 */
	public function setDate(datetime $aDate) {
		$this->_date = $aDate;
	}
    
	/**
	 * @access public
	 * @return PhoneClient
	 * @ReturnType PhoneClient
	 */
    public function getClient(){
        return $this->_iClient;
    }
    
	/**
	 * @access public
	 * @param PhoneClient aClient
	 * @return void
	 * @ParamType aClient PhoneClient
	 * @ReturnType void
	 */
    public function setClient($aClient){
        $this->_iClient = $aClient;
    }
    
	/**
	 * @access public
	 * @return array
	 * @ReturnType ara=ray
	 */
    public function getProducts(){
        return $this->_invoiceProducts;
    }
    
	/**
	 * @access public
	 * @param Product aProduct
	 * @return void
	 * @ParamType aProduct Product
	 * @ReturnType void
	 */
    public function addProduct($aProduct){
        $this->_invoiceProducts[sizeof($this->_invoiceProducts)] = $aProduct;
    }
}
?>